#include "easyview.h"

Easyview::Easyview()
{
    this->resize(1269 , 595);
    this->setWindowTitle("捕捉你心仪的角色");//标题名称
    this->setWindowIcon(QIcon("D:/QT project/fish/sucai/1.png"));//标题上的图标

    this->setBackgroundBrush(QBrush(QPixmap("D:/QT project/fish/sucai/beijin1.png")));

    scence=new QGraphicsScene;
    scence->setSceneRect(0,0,this->width()-2,this->height()-2);
    this->setScene(scence);

    //大炮
    gun=new QGun("D:/QT project/fish/sucai2/buyu1.png");
    gun->setPos(this->width()/2,this->height());
    scence->addItem(gun);

    fish1=new  Qfish("D:/QT project/fish/sucai2/1.png");
    fish1->setPos(50,150);
    scence->addItem(fish1);

    fish2=new  Qfish("D:/QT project/fish/sucai2/2.png");
    fish2->setPos(50,250);
    scence->addItem(fish2);

    fish3=new  Qfish("D:/QT project/fish/sucai2/3.png");
    fish3->setPos(50,350);
    scence->addItem(fish3);

    fish4=new  Qfish("D:/QT project/fish/sucai2/4.png");
    fish4->setPos(50,450);
    scence->addItem(fish4);

    fish4=new  Qfish("D:/QT project/fish/sucai2/5.png");
    fish4->setPos(50,450);
    scence->addItem(fish4);

    //定时器
    timer=new QTimer;
    connect(timer,SIGNAL(timeout()),scence,SLOT(advance()));
    timer->start(100);
}

void Easyview::resizeEvent(QResizeEvent *event)
{
    this->setBackgroundBrush(QBrush(QPixmap("D:/QT project/fish/sucai/beijin1.png").scaled(event->size(),Qt::IgnoreAspectRatio,Qt::SmoothTransformation)));
}


